﻿#region Copyright(c) 2006 ZO, All right reserved.
// -----------------------------------------------------------------------------
// Copyright(c) 2006 ZO, All right reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   1.  Redistribution of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//   2.  Redistribution in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//   3.  The name of the author may not be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
#endregion


#region Using directives

using System.ComponentModel;

#endregion

namespace ZO.SmartCore.Protocols.XMPP.Protocol.Common
{
    /// <summary>
    /// stream-level error conditions
    /// </summary>
    public enum StreamErrorCondition
    {
        /// <summary>
        /// No Error
        /// </summary>
        None = 0,

        /// <summary>
        /// the entity has sent XML that cannot be processed; this error MAY be used instead of the more specific XML-related errors, such as <bad-namespace-prefix/>, <invalid-xml/>, <restricted-xml/>, <unsupported-encoding/>, and <xml-not-well-formed/>, although the more specific errors are preferred.
        /// </summary>
        [Description("bad-format")]
        BadFormat,

        /// <summary>
        /// the entity has sent a namespace prefix that is unsupported, or has sent no namespace prefix on an element that requires such a prefix
        /// </summary>
        [Description("bad-namespace-prefix")]
        BadNamespacePrefix,

        /// <summary>
        /// the server is closing the active stream for this entity because a new stream has been initiated that conflicts with the existing stream.
        /// </summary>
        [Description("conflict")]
        Conflict,

        /// <summary>
        /// the entity has not generated any traffic over the stream for some period of time (configurable according to a local service policy).
        /// </summary>
        [Description("connection-timeout")]
        ConnectionTimeout,

        /// <summary>
        /// the value of the 'to' attribute provided by the initiating entity in the stream header corresponds to a hostname that is no longer hosted by the server.
        /// </summary>
        [Description("host-gone")]
        HostGone,

        /// <summary>
        /// the value of the 'to' attribute provided by the initiating entity in the stream header does not correspond to a hostname that is hosted by the server.
        /// </summary>
        [Description("host-unknown")]
        HostUnknown,

        /// <summary>
        /// a stanza sent between two servers lacks a 'to' or 'from' attribute (or the attribute has no value).
        /// </summary>
        [Description("improper-addressing")]
        ImproperAddressing,

        /// <summary>
        /// the server has experienced a misconfiguration or an otherwise-undefined internal error that prevents it from servicing the stream.
        /// </summary>
        [Description("internal-server-error")]
        InternalServerError,

        /// <summary>
        /// the JID or hostname provided in a 'from' address does not match an authorized JID or validated domain negotiated between servers via SASL or dialback, or between a client and a server via authentication and resource binding.
        /// </summary>
        [Description("invalid-from")]
        InvalidFrom,

        /// <summary>
        /// the stream ID or dialback ID is invalid or does not match an ID previously provided.
        /// </summary>
        [Description("invalid-id")]
        InvalidID,

        /// <summary>
        /// the streams namespace name is something other than "http://etherx.jabber.org/streams" or the dialback namespace name is something other than "jabber:server:dialback"
        /// </summary>
        [Description("invalid-namespace")]
        InvalidNamespace,

        /// <summary>
        /// the entity has sent invalid XML over the stream to a server that performs validation
        /// </summary>
        [Description("invalid-xml")]
        InvalidXml,

        /// <summary>
        /// the entity has attempted to send data before the stream has been authenticated, or otherwise is not authorized to perform an action related to stream negotiation; the receiving entity MUST NOT process the offending stanza before sending the stream error.
        /// </summary>
        [Description("not-authorized")]
        NotAuthorized,

        /// <summary>
        /// the entity has violated some local service policy; the server MAY choose to specify the policy in the <text/> element or an application-specific condition element.
        /// </summary>
        [Description("policy-violation")]
        PolicyViolation,

        /// <summary>
        /// the server is unable to properly connect to a remote entity that is required for authentication or authorization.
        /// </summary>
        [Description("remote-connection-failed")]
        RemoteConnectionFailed,

        /// <summary>
        /// the server lacks the system resources necessary to service the stream.
        /// </summary>
        [Description("resource-constraint")]
        ResourceConstraint,

        /// <summary>
        /// the entity has attempted to send restricted XML features such as a comment, processing instruction, DTD, entity reference, or unescaped character
        /// </summary>
        [Description("restricted-xml")]
        RestrictedXml,

        /// <summary>
        /// the server will not provide service to the initiating entity but is redirecting traffic to another host; the server SHOULD specify the alternate hostname or IP address (which MUST be a valid domain identifier) as the XML character data of the <see-other-host/> element.
        /// </summary>
        [Description("see-other-host")]
        SeeOtherHost,

        /// <summary>
        /// the server is being shut down and all active streams are being closed.
        /// </summary>
        [Description("system-shutdown")]
        SystemShutdown,

        /// <summary>
        /// the error condition is not one of those defined by the other conditions in this list; this error condition SHOULD be used only in conjunction with an application-specific condition.
        /// </summary>
        [Description("undefined-condition")]
        UndefinedCondition,

        /// <summary>
        /// the initiating entity has encoded the stream in an encoding that is not supported by the server 
        /// </summary>
        [Description("unsupported-encoding")]
        UnsupportedEncoding,
        /// <summary>
        /// the initiating entity has sent a first-level child of the stream that is not supported by the server.
        /// </summary>
        [Description("unsupported-stanza-type")]
        UnsupportedStanzaType,

        /// <summary>
        /// the value of the 'version' attribute provided by the initiating entity in the stream header specifies a version of XMPP that is not supported by the server; the server MAY specify the version(s) it supports in the <text/> element.
        /// </summary>
        [Description("unsupported-version")]
        UnsupportedVersion,

        /// <summary>
        /// the initiating entity has sent XML that is not well-formed 
        /// </summary>
        [Description("xml-not-well-formed")]
        XmlNotWellFormed,
    }
}
